Skip to content

Conversation

@liberaldev
Copy link
Contributor

@liberaldev liberaldev commented Dec 28, 2025

This pull request refines how CJK (Chinese, Japanese, Korean) font stacks are applied throughout the site, improving language-specific font rendering and preventing CJK font styles from being incorrectly applied to non-CJK content. It introduces a new CSS variable for the CJK font stack and restructures selectors to ensure fonts are only applied where appropriate.

Font Stack Improvements

  • Introduced a new CSS variable --font-sans-cjk for the CJK font stack in variables.css, centralizing the font definition for easier maintenance. [1]

Selector and Specificity Fixes (Improvement of #3744)

  • Updated selectors to ensure CJK fonts are only applied to elements and languages that require them, preventing CJK font styles from leaking into non-CJK content. The following elements and classes are now explicitly excluded from CJK font application:

    • Monospace semantic elements: code, pre, kbd, samp
    • Font utility classes: .font-default, .font-sans (when used without CJK language attributes)

    This ensures that code blocks and explicitly styled elements maintain their intended fonts even when the page language is set to CJK. [1]

  • Moved the CJK font application rules for .font-default and .font-sans classes to a new utility layer in tailwind.css to ensure proper specificity. These rules now apply the CJK font stack specifically when used with CJK language attributes (lang="ja", lang="ko", lang="zh-CN", lang="zh-TW"), providing proper font rendering for elements that explicitly declare CJK languages. [1]

Summary

These changes collectively ensure that CJK font stacks are applied accurately and only where intended, improving typographic consistency for multilingual content. The improved selector specificity resolves issues where CJK fonts would override non-CJK content, while the new utility layer ensures proper font rendering for elements with explicit CJK language declarations.

…or improved localization consistency and reduced redundancy.
… rules for improved maintainability and reduced duplication.
@liberaldev liberaldev requested a review from a team as a code owner December 28, 2025 09:48
@liberaldev liberaldev changed the title CJK Font Stack Improvements Improve font stack Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant